<template>
	<view class="main">
<!-- 		<u-navbar 
		:titleStyle ="{color:'#FFFFFF'}" 
		leftIconColor="#FFFFFF" 
		bgColor="transparent" 
		placeholder 
		title="区块链详情" 
		@leftClick="back"></u-navbar> -->
		<view class="content">
			<view class="content-cont">
				<view class="Gtitle">
					<text>区块链查征信概览</text>
				</view>
				<u-collapse ref="cont" :border="false" :value="[1,2]">
				    <u-collapse-item :border="false" title="产品数据" name="1">
						<view class="content-cont-item">
							<view class="lable">藏品名称</view>
							<view class="des">{{info.title}}</view>
							<view class="lable">创作者</view>
							<view class="des">{{info.user_name}}</view>
							<view class="lable">收藏者</view>
							<view class="des">{{info.nickname}}</view>
							<view class="lable">发行方</view>
							<view class="des">{{info.company}}</view>
							<view class="lable">作品介绍</view>
							<view class="des">
								<u-parse :content="info.detail"></u-parse>
							</view>
						</view>
				    </u-collapse-item>
					<u-collapse-item :border="false" title="流转信息" name="2">
						<view class="content-cont-item">
							<block v-for="item in list" :key="item.order_sn">
								<view class="content-cont-item-item">
									<view class="des name">{{item.to_nickname}}</view>
									<view class="lable">发放时间</view>
									<view class="des">{{item.create_time}}</view>
									<view class="lable">哈希值</view>
									<view class="des">{{item.hash}}</view>
								</view>
							</block>
						</view>
						<block v-if="list.length<1">
							<Empty text="暂无流转信息"></Empty>
						</block>
						<view class="more" @tab="goodsLog">{{total>list.length?'加载更多':'已加载全部'}}</view>
					</u-collapse-item>
				</u-collapse>
			</view>
		</view>
	</view>
</template>

<script>
	import {mixin} from '@/Mixins/mixin.js'
	import Empty from "@/components/Empty.vue"	
	export default {
		mixins:[mixin],
		components:{Empty},
		data() {
			return {
				id:null,
				page:1,
				size:10,
				info:{},
				list:[],
				total:0
			}
		},
		onReady() {
			
		},
		onLoad(e) {
			this.id = e.id
			this.blockChainInfo(e.id)
			this.goodsLog()
		},
		methods: {
			//区块链详情
			async blockChainInfo(id){
				let data = await this.$http({
					url:this.$api.blockChainInfo,
					method: 'POST',
					hideLoading: true,
					needToken:true,
					data:{
						goods_id:id
					}
				})
				console.log('[区块链详情]',data)
				if(data.code==200){
					this.info = data.data.info
					this.$nextTick(()=>{
						setTimeout(()=>{
							this.$refs.cont.init()
						},500)
					})
				}
			},
			//流转信息
			async goodsLog(){
				let data = await this.$http({
					url:this.$api.goodsLog,
					method: 'POST',
					hideLoading: true,
					needToken:true,
					data:{
						id:this.id,
						page:this.page,
						page_size:this.size
					}
				})
				console.log('[流转信息]',data)
				if(data.code==200){
					if(this.page == 1){
						this.list = []
					}
					this.total = data.data.total
					if(this.list.length<data.data.total){
						this.list = this.list.concat(data.data.data)
						this.page +=1
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		min-height: calc(100vh - 60rpx);
		background:linear-gradient(360deg, #FFFFFF 0%, #000000 100%);
		padding: 30rpx;
		.content{
			border: 2rpx solid #D7D7D7;
			border-radius: 40rpx;
			padding: 22rpx;
			&-cont{
				background: #FFFFFF;
				border-radius: 16rpx;
				padding: 34rpx 32rpx;
				&-item{
					overflow: hidden;
					&-item{
						padding-left: 14rpx;
						position: relative;
						&:not(:last-child){
							&::after{
								content: '';
								width: 2rpx;
								height: calc(100% + 20rpx);
								background: #8EA6D7;
								position: absolute;
								left:0rpx;
								top:30rpx;
							}
						}
						&::before{
							content: '';
							width: 8rpx;
							height: 8rpx;
							background: #8EA6D7;
							position: absolute;
							left:-4rpx;
							top:14rpx;
							border-radius: 50%;
						}
						.name{
							position: relative;
							
						}
					}
				}
				.Gtitle{
					text-align: center;
					margin-bottom: 20rpx;
					text{
						padding: 0 76rpx;
						font-size: 44rpx;
						font-weight: 400;
						color: #403727;
						position: relative;
					}
				}
				/deep/.u-cell__body{
					padding-left: 8rpx;
					padding-right: 8rpx;
					.u-cell__title-text{
						font-size: 38rpx;
						font-weight: 600;
					}
				}
				/deep/.u-collapse-item__content{
					.u-collapse-item__content__text{
						background: #ECF1FB;
					}
				}
				
				.title{
					text-align: center;
					margin-top: 36rpx;
				}
				.des{
					font-size: 26rpx;
					font-weight: 600;
					color: #333333;
					margin-top: 12rpx;
					margin-bottom: 44rpx;
					word-wrap:break-word;
				}
				.lable{
					font-size: 26rpx;
					font-weight: 400;
					color: #999999;
					position: relative;
				}
				.more{
					font-size: 24rpx;
					text-align: center;
					color: #333333;
				}
			}
			
		}
	}
</style>
